/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

/*!
  \file XMLtoData.h
	\brief header file for XML generator

                    \author Jack Elston
             $Date: 2006/10/25 13:34:45 $
*/

#ifndef __DATATOXML_H
#define __DATATOXML_H

#include <unistd.h>
#include <signal.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>

#include "String.h"
#include "command.h"
#include "queue.h"
#include "type_defs.h"
#include "threadedPipe.h"
#include "shmStruct.h"

#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/framework/MemBufFormatTarget.hpp>
#include <xercesc/framework/XMLFormatter.hpp>

  /*<-------Defines--------->*/
  /*<------End Defines------>*/

/************************************************************\
|                    DatatoXML_Parser                        |
\************************************************************/
/*!
  \class DatatoXML_Parser
  \brief reads command data from a fifo, converts it to XML
   and places it into an outgoing fifo

   The DatatoXML_Parser class is designed to sit between two fifo's.
   The incomming fifo produces XML data, one file at a time (the 
   class cannot currently handle determining whether more data is
   need to complete the XML file), and encapsulates the data in
   an appropriate RECUV command struct.  This struct is then sent to
   the outgoing fifo.
 */
class DataToXML_Parser : public ThreadedPipe
{
private:
  void parse(const Command &cmd, in_addr address);

public:
	DataToXML_Parser(String name);

	~DataToXML_Parser();

  ThreadedPipe::commMode mode();
	void update();
};

#endif //define
